/* style.css (v2) */
:root {
    /* --- 默认主题颜色 --- */
    --cip-panel-bg-color: rgba(255, 255, 255, 0.25);
    --cip-border-color: rgba(255, 255, 255, 0.4);
    --cip-text-color: #333;
    --cip-accent-color: #ff7f50;
    --cip-accent-hover-color: #e56a40;
    --cip-insert-text-color: white;
    --cip-active-bg-color: rgba(255, 127, 80, 0.3);
    --cip-input-bg-color: rgba(255, 255, 255, 0.5);
    --cip-tabs-bg-color: transparent;
    --cip-delete-color: #e74c3c;
    --cip-border-radius: 12px;
    --cip-transition-speed: 0.3s;
}

/* 移动设备触摸优化 */
@media (max-width: 768px) {
    .cip-frosted-glass {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    #cip-input-panel.cip-docked {
        width: calc(100vw - 24px) !important;
        max-width: 420px;
        max-height: calc(100vh - 32px);
        max-height: calc(100dvh - 32px);
    }
    .cip-tab-button,
    .cip-sub-option-btn,
    #cip-recall-button,
    #cip-insert-button,
    .cip-modal-actions button {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    /* 移动端：让子标题行可横向滚动且不换行 */
    #cip-text-content .cip-sub-options-container {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        gap: 6px;
    }

    /* 移动端：设置面板使用动态视口单位，避免地址栏影响定位 */
    #cip-settings-panel {
        top: 50dvh;
        left: 50dvw;
        width: calc(100dvw - 40px);
        max-width: 420px;
        max-height: calc(100dvh - 60px);
        padding: 16px;
    }
    #cip-settings-panel.hidden {
        transform: translate(-50%, -50%) scale(0.95);
    }

    /* 调整：移动端浮标大小 */
    #cip-carrot-button {
        width: 44px;
        height: 44px;
        font-size: 24px;
    }

    /* 移动端：定时设置布局优化 */
    .cip-alarm-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        row-gap: 8px;
        margin-bottom: 8px;
    }
    .cip-alarm-note {
        grid-column: 1 / -1; /* 注释独占一行 */
        text-align: left;
        margin-top: -2px;
    }
    #cip-alarm-command {
        width: 100%;
        margin-top: 8px; /* 与上方网格拉开距离 */
    }

    /* 移动端：同步设置布局优化 */
    .cip-sync-actions,
    .cip-sync-path-actions {
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 8px;
    }
    .cip-sync-actions button,
    .cip-sync-actions .cip-button-label,
    .cip-sync-path-actions button {
        flex: 1 1 calc(50% - 8px);
        min-width: 120px;
    }
    .cip-sync-path-container {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }
    .cip-sync-path-container label {
        text-align: left;
    }
    #cip-sync-path-input {
        width: 100%;
    }
}
.cip-frosted-glass {
    background: var(--cip-panel-bg-color);
    -webkit-backdrop-filter: blur(15px);
    backdrop-filter: blur(15px);
    border-radius: var(--cip-border-radius);
    border: 1px solid var(--cip-border-color);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}
#cip-carrot-button {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 30px;
    height: 30px;
    background: var(--cip-accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: move;
    z-index: 1000;
    transition:
        transform 0.2s ease,
        background-color var(--cip-transition-speed) ease;
    -webkit-user-select: none;
    user-select: none;
}
#cip-carrot-button.is-dragging {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}
#cip-carrot-button:hover {
    transform: scale(1.1);
}
#cip-input-panel {
    position: fixed;
    width: 350px;
    max-width: 90vw;
    display: none;
    flex-direction: column;
    z-index: 1001;
    opacity: 0;
    transition:
        opacity var(--cip-transition-speed) ease,
        transform var(--cip-transition-speed) ease;
    transform: scale(0.95);
    max-height: calc(100vh - 20px);
    overflow-y: auto;
}
#cip-input-panel.active {
    display: flex;
    opacity: 1;
    transform: scale(1);
}
#cip-input-panel.cip-docked {
    position: fixed;
    right: 16px;
    bottom: 16px;
    width: min(360px, calc(100vw - 32px));
    max-width: 360px;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    transform: none;
    z-index: 1100;
    margin-left: 0;
}

#cip-input-panel.cip-docked:not(.active) {
    display: none;
    opacity: 0;
}

#cip-input-panel.cip-docked.active {
    display: flex;
    opacity: 1;
}
#cip-panel-tabs {
    display: flex;
    padding: 8px;
    border-bottom: 1px solid var(--cip-border-color);
    background-color: var(--cip-tabs-bg-color); /* 应用变量 */
    transition: background-color var(--cip-transition-speed) ease;
}
.cip-tab-button {
    flex-grow: 1;
    padding: 8px 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    color: var(--cip-text-color);
    border-radius: 8px;
    transition:
        background-color var(--cip-transition-speed) ease,
        color var(--cip-transition-speed) ease;
}
.cip-tab-button.active {
    background-color: var(--cip-active-bg-color);
    font-weight: bold;
}
#cip-format-display {
    padding: 5px 12px;
    font-size: 12px;
    color: #666;
    background: rgba(0, 0, 0, 0.05);
    text-align: center;
    min-height: 18px;
}
#cip-panel-content {
    padding: 12px;
    flex-grow: 1;
}
.cip-content-section {
    display: none;
    flex-direction: column;
    gap: 3px;
}
.cip-content-section.active {
    display: flex;
}
.cip-sub-options-container {
    display: flex;
    flex-wrap: nowrap; /* 确保小标题不换行 */
    gap: 6px; /* 减小间距 */
    padding-bottom: 8px;
    border-bottom: 1px solid var(--cip-border-color);
    margin-bottom: 0px;
    overflow-x: auto; /* 超出时允许横向滚动 */
    scrollbar-width: thin;
}
.cip-sub-option-btn {
    padding: 4px 10px;
    font-size: 12px;
    border: 1px solid var(--cip-border-color);
    border-radius: 16px;
    background: transparent;
    cursor: pointer;
    color: var(--cip-text-color);
    transition: all var(--cip-transition-speed) ease;
    position: relative;
    white-space: nowrap; /* 防止BUNNY等子标题换行 */
}
.cip-sub-option-btn.active {
    background-color: var(--cip-accent-color);
    color: white;
    border-color: var(--cip-accent-color);
}
#cip-add-category-btn {
    font-weight: bold;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
}
.cip-category-action-icon {
    cursor: pointer;
    font-style: normal;
}
.cip-delete-category-btn {
    color: var(--cip-delete-color);
}
/* 统一所有主要输入框样式 */
/* --- 新增: 主输入框包裹容器 --- */
.cip-main-input-wrapper {
    position: relative;
    width: 100%;
    display: flex;
}
.cip-main-input-wrapper #cip-main-input {
    width: 100%; /* 确保文本域填满容器 */
    padding-left: 36px; /* 为emoji图标留出空间 */
    box-sizing: border-box; /* 确保padding不会增加总宽度 */
}
.cip-main-input-wrapper #cip-emoji-picker-btn {
    position: absolute;
    bottom: 5px;
    left: 5px;
    font-size: 24px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity var(--cip-transition-speed);
    z-index: 2; /* 确保在文本域之上 */
    -webkit-user-select: none;
    user-select: none;
}
.cip-main-input-wrapper #cip-emoji-picker-btn:hover {
    opacity: 1;
}
#cip-main-input,
#cip-voice-message,
#cip-new-stickers-input {
    width: calc(100% - 20px);
    min-height: 80px;
    padding: 10px;
    border: none;
    border-radius: var(--cip-border-radius);
    background-color: var(--cip-input-bg-color);
    font-size: 14px;
    resize: vertical;
    transition: background-color var(--cip-transition-speed) ease;
}
#cip-voice-duration,
#cip-new-category-name {
    width: calc(100% - 20px);
    padding: 10px;
    border: none;
    border-radius: var(--cip-border-radius);
    background-color: var(--cip-input-bg-color);
    font-size: 14px;
    transition: background-color var(--cip-transition-speed) ease;
}
#cip-panel-footer {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 0 12px 12px 12px;
    gap: 8px;
    flex-wrap: nowrap;
}
.cip-wallet-row {
    display: flex;
    gap: 10px;
    width: 100%;
}
.cip-wallet-row input {
    flex: 1;
}
.cip-wallet-row + .cip-wallet-row {
    margin-top: 8px;
}
#cip-wallet-platform,
#cip-wallet-amount,
#cip-wallet-message {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    border: none;
    border-radius: var(--cip-border-radius);
    background-color: var(--cip-input-bg-color);
    font-size: 14px;
    transition: background-color var(--cip-transition-speed) ease;
}
/* 新增：底部左侧控制按钮容器 */
#cip-footer-controls {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
}

#cip-footer-controls > * {
    flex-shrink: 0;
}

#cip-settings-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 20px;
    line-height: 1;
}

.cip-docked-launcher,
#cip-docked-launcher {
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
    padding: 6px 10px;
    border: none;
    border-radius: 8px;
    background-color: var(
        --cip-panel-bg-color,
        rgba(32, 32, 32, 0.8)
    );
    color: var(--cip-text-color, #f5f5f5);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition:
        transform var(--cip-transition-speed),
        box-shadow var(--cip-transition-speed),
        background-color var(--cip-transition-speed);
}

.cip-docked-launcher.active,
#cip-docked-launcher.active {
    display: flex;
}

.cip-docked-launcher:hover,
#cip-docked-launcher:hover {
    transform: translateY(-1px);
}

.cip-docked-launcher[aria-pressed='true'],
#cip-docked-launcher[aria-pressed='true'] {
    box-shadow: none;
}

.cip-footer-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    color: var(--cip-text-color, #f5f5f5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 6px;
    transition: transform var(--cip-transition-speed),
        opacity var(--cip-transition-speed);
}

.cip-footer-icon:hover {
    transform: translateY(2px);
}

.cip-footer-icon:disabled,
.cip-footer-icon[aria-disabled='true'] {
    cursor: default;
    opacity: 0.5;
    transform: none;
}

.cip-switch {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: var(--cip-text-color, #f5f5f5);
    font-size: 14px;
    user-select: none;
    transition: opacity var(--cip-transition-speed);
    white-space: nowrap;
}

.cip-switch.disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.cip-switch-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.cip-switch-track {
    position: relative;
    width: 40px;
    height: 22px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    transition: background-color var(--cip-transition-speed),
        box-shadow var(--cip-transition-speed);
}

.cip-switch-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    transition: transform var(--cip-transition-speed),
        background-color var(--cip-transition-speed);
}

.cip-switch.active .cip-switch-track,
.cip-switch-input:checked + .cip-switch-track {
    background: var(--cip-accent-color);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.cip-switch.active .cip-switch-thumb,
.cip-switch-input:checked + .cip-switch-track .cip-switch-thumb {
    transform: translateX(16px);
    background: var(--cip-insert-text-color, #ffffff);
}

.cip-switch-input:disabled + .cip-switch-track {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

.cip-switch:not(.disabled):hover .cip-switch-track {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15);
}

.cip-switch-text {
    letter-spacing: 0.08em;
}
#cip-sync-button,
#cip-theme-button,
#cip-alarm-button,
#cip-export-settings-btn,
#cip-import-settings-btn {
    font-size: 24px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity var(--cip-transition-speed);
    position: relative;
    -webkit-user-select: none;
    user-select: none;
}
#cip-gear-button {
    font-size: 24px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity var(--cip-transition-speed);
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
}
#cip-gear-button:hover {
    opacity: 1;
}
#cip-export-settings-btn:hover,
#cip-import-settings-btn:hover,
#cip-theme-button:hover,
#cip-alarm-button:hover {
    opacity: 1;
}
.cip-footer-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: nowrap;
    margin-left: auto;
}
#cip-recall-button,
#cip-insert-button {
    padding: 6px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color var(--cip-transition-speed);
    white-space: nowrap;
    flex-shrink: 0;
}
#cip-recall-button {
    background-color: var(--cip-accent-color);
    color: #444;
}
#cip-recall-button:hover {
    background-color: var(--cip-accent-hover-color);
}
#cip-insert-button {
    background-color: var(--cip-accent-color);
    color: var(--cip-insert-text-color); /* 应用变量 */
}
#cip-insert-button:hover {
    background-color: var(--cip-accent-hover-color); /* 应用变量 */
}
emoji-picker {
    position: fixed;
    z-index: 1002;
    display: none;
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
}
@media (max-width: 768px) {
    emoji-picker {
        width: calc(100vw - 40px) !important;
        height: auto !important;
        max-width: 320px;
        max-height: calc(100vh - 40px);
    }
}
#cip-sticker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    height: 150px;
    overflow-y: auto;
    padding: 5px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 8px;
}
.cip-sticker-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
}
.cip-sticker-item {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color var(--cip-transition-speed);
}
.cip-sticker-item.selected {
    border-color: var(--cip-accent-color);
}
.cip-delete-sticker-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background-color: var(--cip-delete-color);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--cip-transition-speed);
    transform: scale(0.9);
}
.cip-sticker-wrapper:hover .cip-delete-sticker-btn {
    opacity: 1;
    transform: scale(1);
}
.cip-sticker-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    color: #888;
    align-self: center;
}
.cip-modal-backdrop {
    position: absolute;
    top: auto;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1003;
    opacity: 1;
    transition: opacity var(--cip-transition-speed);
    padding: 20px;
    box-sizing: border-box;
}
.cip-modal-backdrop.hidden {
    opacity: 0;
    pointer-events: none;
}
.cip-modal-content {
    width: 320px;
    max-width: 100%;
    max-height: calc(100vh - 40px);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    box-sizing: border-box;
}

/* --- 新增: 主设置面板样式 --- */
#cip-settings-panel {
    position: fixed;
    top: 50vh;
    left: 50vw;
    transform: translate(-50%, -50%);
    width: 420px;
    max-width: 90vw;
    max-height: calc(100dvh - 40px);
    z-index: 1004;
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 16px;
    overflow-y: auto;
    transition:
        opacity var(--cip-transition-speed),
        transform var(--cip-transition-speed);
}
#cip-settings-panel.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.95);
}
.cip-settings-header {
    /* 调整：缩小齿轮面板导航与内容间距 */
    margin-bottom: 10px;
}
#cip-settings-tabs {
    display: flex;
    /* 调整：压缩齿轮面板导航按钮间距 */
    gap: 4px;
    flex-wrap: nowrap;
    justify-content: center;
}
.cip-settings-tab {
    /* 调整：压缩齿轮面板导航按钮间距 */
    flex: 1 1 0;
    min-width: 0;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    color: var(--cip-text-color);
    cursor: pointer;
    transition: all var(--cip-transition-speed);
    font-size: 14px;
}
.cip-settings-tab:hover {
    background: rgba(255, 255, 255, 0.2);
}
.cip-settings-tab.active {
    background: var(--cip-active-bg-color);
    border-color: var(--cip-active-bg-color);
}
#cip-settings-sections {
    flex: 1;
    overflow-y: auto;
}
.cip-settings-section {
    display: none;
}
.cip-settings-section.active {
    display: block;
}
.cip-settings-footer {
    display: flex;
    justify-content: center;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}
#cip-close-settings-panel-btn {
    padding: 10px 30px;
    background: var(--cip-active-bg-color);
    border: none;
    border-radius: 20px;
    color: white;
    cursor: pointer;
    transition: all var(--cip-transition-speed);
}
#cip-close-settings-panel-btn:hover {
    transform: scale(1.05);
}

/* --- 新增: 主题设置面板样式 --- */
#cip-theme-settings-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 380px;
    max-width: 90vw;
    max-height: 80vh;
    z-index: 1004;
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 16px;
    overflow-y: auto;
    transition:
        opacity var(--cip-transition-speed),
        transform var(--cip-transition-speed);
}
#cip-theme-settings-panel.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.95);
}
#cip-theme-settings-panel h3 {
    margin: 0 0 10px 0;
    text-align: center;
    color: var(--cip-text-color);
}
.cip-theme-options-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: center;
}
.cip-theme-options-grid label {
    font-size: 14px;
    color: var(--cip-text-color);
    justify-self: start;
}
.cip-color-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--cip-border-color);
    border-radius: 8px;
    background-color: var(--cip-input-bg-color);
    padding-right: 5px; /* 为拾色器留出空间 */
}
.cip-color-input-wrapper input[type='text'] {
    flex-grow: 1;
    border: none;
    background: transparent;
    padding: 8px;
    font-size: 14px;
    color: var(--cip-text-color);
    width: 100%;
    box-sizing: border-box;
}
.cip-color-input-wrapper input[type='text']:focus {
    outline: none;
}
.cip-color-picker {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    cursor: pointer;
    background-color: transparent;
    border: none;
    padding: 0;
}
.cip-color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}
.cip-color-picker::-webkit-color-swatch {
    border-radius: 6px;
    border: 1px solid var(--cip-border-color);
}
.cip-color-picker::-moz-color-swatch {
    border-radius: 6px;
    border: 1px solid var(--cip-border-color);
}
.cip-theme-options-grid input[type='text'] {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--cip-border-color);
    border-radius: 8px;
    background-color: var(--cip-input-bg-color);
    font-size: 14px;
    box-sizing: border-box;
    color: var(--cip-text-color);
}
.cip-theme-manager {
    margin-top: 10px;
    padding-top: 15px;
    border-top: 1px solid var(--cip-border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.cip-theme-manager .cip-theme-actions,
.cip-theme-manager .cip-theme-save-new {
    display: flex;
    gap: 10px;
    width: 100%;
}
.cip-theme-manager select,
.cip-theme-manager input {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid var(--cip-border-color);
    border-radius: 8px;
    background-color: var(--cip-input-bg-color);
    font-size: 14px;
    color: var(--cip-text-color);
}
.cip-theme-manager button {
    padding: 8px 12px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: background-color var(--cip-transition-speed);
}
.cip-theme-manager button.cip-save-btn {
    background-color: var(--cip-accent-color);
    color: white;
}
.cip-theme-manager button.cip-delete-btn {
    background-color: var(--cip-delete-color);
    color: white;
}
#cip-close-theme-panel-btn {
    margin: 10px auto 0;
    width: 50%;
    padding: 10px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    background-color: #ddd;
    color: #333;
    font-size: 16px;
    transition: background-color var(--cip-transition-speed);
}
#cip-close-theme-panel-btn:hover {
    background-color: #ccc;
}

/* --- 新增: 定时指令面板样式 --- */
#cip-alarm-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 350px;
    max-width: 90vw;
    z-index: 1005; /* 比主题面板高一级 */
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 15px;
    transition:
        opacity var(--cip-transition-speed),
        transform var(--cip-transition-speed);
}
#cip-alarm-panel.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.95);
}
#cip-alarm-panel h3 {
    margin: 0 0 5px 0;
    text-align: center;
    color: var(--cip-text-color);
}
.cip-alarm-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 10px;
    align-items: center;
}
.cip-alarm-grid label {
    font-size: 14px;
    color: var(--cip-text-color);
    text-align: right;
    grid-column: span 1;
}
.cip-alarm-grid input {
    grid-column: span 1;
}
.cip-alarm-note {
    grid-column: span 2;
    font-size: 12px;
    color: #666;
    text-align: left;
    align-self: center;
}
.cip-alarm-grid input[type='number'] {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--cip-border-color);
    border-radius: 8px;
    background-color: var(--cip-input-bg-color);
    font-size: 14px;
    box-sizing: border-box;
    color: var(--cip-text-color);
    -moz-appearance: textfield; /* Firefox */
    appearance: textfield;
}
.cip-alarm-grid input[type='number']::-webkit-outer-spin-button,
.cip-alarm-grid input[type='number']::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
#cip-alarm-command {
    width: calc(100% - 20px);
    min-height: 100px;
    padding: 10px;
    border: none;
    border-radius: var(--cip-border-radius);
    background-color: var(--cip-input-bg-color);
    font-size: 14px;
    resize: vertical;
    transition: background-color var(--cip-transition-speed) ease;
}
#cip-alarm-status {
    padding: 8px;
    text-align: center;
    font-size: 14px;
    color: var(--cip-text-color);
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}
.cip-alarm-actions {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}
.cip-alarm-actions button {
    flex-grow: 1;
    padding: 10px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background-color var(--cip-transition-speed);
}
#cip-start-alarm-btn {
    background-color: var(--cip-accent-color);
    color: var(--cip-insert-text-color);
}
#cip-start-alarm-btn:hover {
    background-color: var(--cip-accent-hover-color);
}
#cip-stop-alarm-btn {
    background-color: var(--cip-delete-color);
    color: white;
}
#cip-restore-defaults-btn {
    background-color: var(--cip-accent-color);
    color: white;
    flex-grow: 0;
    padding: 10px 15px;
}
#cip-close-alarm-panel-btn {
    margin-top: 5px;
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    background-color: var(--cip-accent-color);
    color: #333;
    font-size: 16px;
    transition: background-color var(--cip-transition-speed);
}
#cip-close-alarm-panel-btn:hover {
    background-color: var(--cip-accent-hover-color);
}
/* ---- */

@media (max-width: 768px) {
    .cip-modal-content {
        width: calc(100vw - 40px);
        max-width: 340px;
        margin: 0;
        padding: 16px;
    }
    .cip-modal-backdrop {
        padding: 10px;
    }
}
@media (max-width: 480px) {
    .cip-modal-content,
    #cip-theme-settings-panel {
        width: calc(100vw - 20px);
        padding: 12px;
        gap: 12px;
    }
    #cip-input-panel.cip-docked {
        width: calc(100vw - 20px) !important;
        max-width: none;
        max-height: calc(100vh - 32px);
        max-height: calc(100dvh - 32px);
    }
    .cip-modal-backdrop {
        padding: 10px;
    }
    .cip-modal-content h3,
    #cip-theme-settings-panel h3 {
        font-size: 16px;
        margin: 0;
    }
    .cip-modal-content p {
        font-size: 12px;
    }
    .cip-modal-actions button {
        padding: 6px 12px;
        font-size: 14px;
    }

    #cip-input-panel {
        width: calc(100vw - 20px) !important;
        max-width: 400px;
        max-height: calc(100vh - 40px);
    }
    #cip-main-input,
    #cip-voice-message,
    #cip-new-stickers-input {
        min-height: 60px;
        font-size: 16px;
    }
    #cip-voice-duration,
    #cip-new-category-name {
        font-size: 16px;
    }
    #cip-wallet-platform,
    #cip-wallet-amount,
    #cip-wallet-message {
        font-size: 16px;
    }
    .cip-tab-button {
        padding: 10px 8px;
        font-size: 13px;
    }
    #cip-carrot-button {
        width: 36px;
        height: 36px;
        font-size: 26px;
        min-width: 22px;
        min-height: 22px;
    }
}
.cip-modal-content p {
    font-size: 13px;
    margin: 0;
    color: #555;
    line-height: 1.5;
}
.cip-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.cip-modal-actions button {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
}
.cip-modal-actions button:first-child {
    background: #eee;
}
.cip-modal-actions button:last-child {
    background: var(--cip-accent-color);
    color: white;
}
/* --- 新增: 头像配置面板样式 --- */
#cip-avatar-button {
    font-size: 24px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity var(--cip-transition-speed);
    position: relative;
    -webkit-user-select: none;
    user-select: none;
}

#cip-avatar-button:hover {
    opacity: 1;
}

#cip-avatar-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 380px;
    max-width: 90vw;
    max-height: 80vh;
    z-index: 1006; /* 比定时面板层级更高 */
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 16px;
    overflow-y: auto;
    transition:
        opacity var(--cip-transition-speed),
        transform var(--cip-transition-speed);
}

#cip-avatar-panel.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.95);
}

#cip-avatar-panel h3 {
    margin: 0 0 10px 0;
    text-align: center;
    color: var(--cip-text-color);
}

/* 头像与头像框分区样式 */
.cip-avatar-section,
.cip-frame-section {
    padding: 15px;
    border-radius: var(--cip-border-radius);
    background: rgba(0, 0, 0, 0.03);
    margin-bottom: 15px;
}

/* 新增: 头像配置子标签样式 */
.cip-avatar-subtabs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.cip-avatar-subtab {
    padding: 4px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: var(--cip-text-color);
    cursor: pointer;
    transition: background-color var(--cip-transition-speed);
}
.cip-avatar-subtab.active {
    background: var(--cip-active-bg-color);
    border-color: var(--cip-active-bg-color);
}
.cip-avatar-divider {
    color: var(--cip-text-color);
    opacity: 0.6;
}
.cip-avatar-separator {
    border: none;
    border-top: 1px solid var(--cip-border-color);
    margin: 6px 0 12px;
}
.cip-avatar-pane {
    display: none;
}
.cip-avatar-pane.active {
    display: block;
}

.cip-section-title {
    margin: 0 0 12px 0;
    font-size: 15px;
    font-weight: bold;
    color: var(--cip-accent-color);
    padding-bottom: 8px;
    border-bottom: 2px solid var(--cip-accent-color);
}

.cip-avatar-grid {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 12px;
    align-items: center;
}

.cip-frame-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.cip-frame-input-wrapper input {
    flex: 1;
}

.cip-adjust-frame-btn {
    padding: 6px 10px;
    background-color: var(--cip-accent-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color var(--cip-transition-speed);
    flex-shrink: 0;
}

.cip-adjust-frame-btn:hover {
    background-color: var(--cip-accent-hover-color);
}

.cip-frame-adjust-panel {
    margin-top: 15px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: var(--cip-border-radius);
    border: 1px solid var(--cip-border-color);
    transition: opacity var(--cip-transition-speed);
}

.cip-frame-adjust-panel.hidden {
    display: none;
}

.cip-frame-adjust-panel h4 {
    margin: 0 0 12px 0;
    text-align: center;
    color: var(--cip-text-color);
    font-size: 14px;
}

.cip-adjust-control {
    margin-bottom: 12px;
}

.cip-adjust-control label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--cip-text-color);
}

.cip-adjust-control input[type="range"] {
    width: 100%;
    cursor: pointer;
}

.cip-adjust-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.cip-adjust-actions button {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color var(--cip-transition-speed);
}

#cip-frame-reset-btn {
    background-color: #888;
    color: white;
}

#cip-frame-reset-btn:hover {
    background-color: #666;
}

#cip-frame-apply-btn {
    background-color: var(--cip-accent-color);
    color: white;
}

#cip-frame-apply-btn:hover {
    background-color: var(--cip-accent-hover-color);
}

.cip-avatar-grid label {
    font-size: 14px;
    color: var(--cip-text-color);
    justify-self: start;
}

.cip-avatar-grid input[type='text'] {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--cip-border-color);
    border-radius: var(--cip-border-radius);
    background-color: var(--cip-input-bg-color);
    font-size: 14px;
    box-sizing: border-box;
    color: var(--cip-text-color);
}

.cip-avatar-manager {
    margin-top: 10px;
    padding-top: 15px;
    border-top: 1px solid var(--cip-border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cip-avatar-manager .cip-avatar-actions,
.cip-avatar-manager .cip-avatar-save-new {
    display: flex;
    gap: 10px;
    width: 100%;
}

.cip-avatar-manager select,
.cip-avatar-manager input {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid var(--cip-border-color);
    border-radius: 8px;
    background-color: var(--cip-input-bg-color);
    font-size: 14px;
    color: var(--cip-text-color);
}

.cip-avatar-manager button {
    padding: 8px 12px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: background-color var(--cip-transition-speed);
}

.cip-avatar-manager button.cip-apply-btn {
    background-color: var(--cip-accent-color);
    color: white;
}

.cip-avatar-manager button.cip-delete-btn {
    background-color: var(--cip-delete-color);
    color: white;
}

#cip-close-avatar-panel-btn {
    margin: 10px auto 0;
    width: 50%;
    padding: 10px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    background-color: #ddd;
    color: #333;
    font-size: 16px;
    transition: background-color var(--cip-transition-speed);
}

#cip-close-avatar-panel-btn:hover {
    background-color: #ccc;
}
/* --- 新增: 同步设置面板样式 --- */
#cip-sync-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 380px;
    max-width: 90vw;
    z-index: 1007; /* 层级最高 */
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 16px;
    transition: opacity var(--cip-transition-speed), transform var(--cip-transition-speed);
}
#cip-sync-panel.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.95);
}
#cip-sync-panel h3 {
    margin: 0 0 10px 0;
    text-align: center;
    color: var(--cip-text-color);
}
.cip-sync-actions, .cip-sync-path-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}
.cip-sync-actions button, .cip-sync-actions .cip-button-label,
.cip-sync-path-actions button {
    flex-grow: 1;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--cip-border-color);
    cursor: pointer;
    font-size: 16px;
    background-color: var(--cip-input-bg-color);
    color: var(--cip-text-color);
    text-align: center;
    transition: background-color var(--cip-transition-speed);
}
.cip-sync-actions button:hover, .cip-sync-actions .cip-button-label:hover,
.cip-sync-path-actions button:hover {
    background-color: var(--cip-border-color);
}
.cip-sync-path-container {
    display: flex;
    align-items: center;
    gap: 8px;
}
.cip-sync-path-container label {
    font-size: 14px;
    color: var(--cip-text-color);
    flex-shrink: 0;
}
#cip-sync-path-input {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid var(--cip-border-color);
    border-radius: 8px;
    background-color: var(--cip-input-bg-color);
    font-size: 14px;
    color: var(--cip-text-color);
}
.cip-sync-note {
    font-size: 12px;
    color: #666;
    text-align: center;
    margin: 5px 0;
    padding: 8px;
    background: rgba(0,0,0,0.05);
    border-radius: 8px;
}
#cip-close-sync-panel-btn {
    margin-top: 10px;
    padding: 10px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    background-color: var(--cip-accent-color);
    color: var(--cip-insert-text-color);
    font-size: 16px;
    font-weight: bold;
    transition: background-color var(--cip-transition-speed);
}
#cip-close-sync-panel-btn:hover {
    background-color: var(--cip-accent-hover-color);
}

/* 新增：设置中心（齿轮） */
#cip-settings-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--cip-border-color);
    padding-bottom: 8px;
}
.cip-settings-tab {
    padding: 6px 12px;
    font-size: 13px;
    border: 1px solid var(--cip-border-color);
    border-radius: 16px;
    background: transparent;
    color: var(--cip-text-color);
    cursor: pointer;
    transition: all var(--cip-transition-speed);
}
.cip-settings-tab.active,
.cip-settings-tab:hover {
    background-color: var(--cip-active-bg-color);
}
.cip-settings-panels {
    padding: 10px 0;
}
.cip-settings-panel-note {
    font-size: 12px;
    color: #666;
    text-align: center;
}

/* --- 新增: 语音设置面板样式 --- */
.cip-tts-grid {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}
.cip-tts-grid label {
    font-size: 14px;
    color: var(--cip-text-color);
}
.cip-tts-grid input,
.cip-tts-grid select {
    padding: 8px;
    border: 1px solid var(--cip-border-color);
    border-radius: 8px;
    background-color: var(--cip-input-bg-color);
    font-size: 14px;
    color: var(--cip-text-color);
}
.cip-tts-subsection {
    margin: 10px 0;
    padding: 12px;
    background: rgba(0,0,0,0.03);
    border-radius: var(--cip-border-radius);
    border: 1px solid var(--cip-border-color);
}
.cip-checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.cip-tts-range-grid {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 10px;
    align-items: center;
}
#cip-tts-test-text {
    width: calc(100% - 20px);
    min-height: 45px;
    padding: 10px;
    border: none;
    border-radius: var(--cip-border-radius);
    background-color: var(--cip-input-bg-color);
    font-size: 14px;
    resize: vertical;
}
.cip-tts-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.cip-tts-speed {
    display: grid;
    grid-template-columns: 110px 1fr 60px;
    gap: 10px;
    align-items: center;
    margin-top: 8px;
}
.cip-tts-upload {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--cip-border-color);
}
.cip-tts-upload-grid {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 10px;
    align-items: center;
}
.cip-tts-upload-file-row { display:flex; align-items:center; gap:8px; }
.cip-tts-upload-hint { font-size:12px; color:#666; }
.cip-tts-actions button {
    flex: 1;
    padding: 8px 12px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: background-color var(--cip-transition-speed);
    background-color: var(--cip-accent-color);
    color: var(--cip-insert-text-color);
}
.cip-tts-status {
    margin-top: 6px;
    font-size: 12px;
    color: #666;
}

/* 子级语音导航 */
.cip-tts-subtabs {
    display: flex;
    align-items: center;
    gap: 8px;
}
.cip-tts-subtab {
    padding: 4px 10px;
    border: 1px solid var(--cip-border-color);
    border-radius: 16px;
    background: transparent;
    color: var(--cip-text-color);
    cursor: pointer;
}
.cip-tts-subtab.active {
    background-color: var(--cip-active-bg-color);
}
.cip-tts-divider { color: var(--cip-text-color); opacity: .6; }
.cip-tts-separator { border: none; border-top: 1px solid var(--cip-border-color); margin: 6px 0 10px; }
.cip-tts-pane { display: none; }
.cip-tts-pane.active { display: block; }

/* 音色删除按钮与行 */
.cip-tts-voice-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
#cip-tts-voice-delete {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: var(--cip-delete-color);
    color: #fff;
    cursor: pointer;
}

/* 气泡点击朗读提示样式 */
.cip-bubble-tts {
    cursor: pointer;
}

@media (max-width: 768px) {
    .cip-tts-grid,
    .cip-tts-range-grid {
        grid-template-columns: 1fr;
    }
}